package com.company;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

public class Class01 {
    private static final Logger logger = LoggerFactory.getLogger("客户端");

    public static void main(String[] args) throws IOException {
        String content = new String("你好啊哈哈哈");

        Socket socket = new Socket("192.168.1.105", 9988);

        OutputStream outputStream = socket.getOutputStream();

        outputStream.write(content.getBytes());

        InputStream inputStream = socket.getInputStream();

        byte[] buf = new byte[1024];
        int len = inputStream.read(buf);
        String msg = new String(buf, 0, len);
        logger.trace("客户端发送数据" + msg);

        inputStream.close();
        outputStream.close();
        socket.close();


    }
}
